import Vue from 'vue'
import Router from 'vue-router'
//原始方式
//import EventOverview from '@/pages/EventOverview'
//import EventSchedule from '@/pages/EventSchedule'
//import TeamPerformance from '@/pages/TeamPerformance'
//import RankingList from '@/pages/RankingList'
//import EventDetails from '@/pages/EventDetails'
//import PlayerDetails from '@/pages/PlayerDetails'
//import TeamDetails from '@/pages/TeamDetails'
//import MainPage from '@/pages/MainPage'

//模块切割 按需加载方式↓
const EventOverview = resolve=>require.ensure([],()=>resolve(require('@/pages/EventOverview.vue')),'EventOverview');
const EventSchedule = resolve=>require.ensure([],()=>resolve(require('@/pages/EventSchedule.vue')),'EventSchedule');
const TeamPerformance = resolve=>require.ensure([],()=>resolve(require('@/pages/TeamPerformance.vue')),'TeamPerformance');
const RankingList = resolve=>require.ensure([],()=>resolve(require('@/pages/RankingList.vue')),'RankingList');
const EventDetails = resolve=>require.ensure([],()=>resolve(require('@/pages/EventDetails.vue')),'EventDetails');
const PlayerDetails = resolve=>require.ensure([],()=>resolve(require('@/pages/PlayerDetails.vue')),'PlayerDetails');
const TeamDetails = resolve=>require.ensure([],()=>resolve(require('@/pages/TeamDetails.vue')),'TeamDetails');
const MainPage = resolve=>require.ensure([],()=>resolve(require('@/pages/MainPage.vue')),'MainPage');


Vue.use(Router)

export default new Router({
	mode:'hash',
	routes: [
    
    {
    	path:'/',
    	name:'/',
    	component:EventOverview
    },
    {
    	path:'/EventOverview',
    	name:'EventOverview',
    	component:EventOverview
    },
    {
    	path:'/EventSchedule',
    	name:'EventSchedule',
    	component:EventSchedule
    },
    {
    	path:'/TeamPerformance',
    	name:'TeamPerformance',
    	component:TeamPerformance,
    	children:[]
    },
    {
    	path:'/RankingList',
    	name:'RankingList',
    	component:RankingList
    },
    {
		path:'/EventDetails/:id',
		name:'EventDetails',
		component:EventDetails,
	},
    {
		path:'/PlayerDetails/:name',
		name:'PlayerDetails',
		component:PlayerDetails,
	},
    {
		path:'/TeamDetails/:name',
		name:'TeamDetails',
		component:TeamDetails,
	}
    
    
  ]
})
